#include "registerserver.h"

#include "serverlink.h"

namespace servermanager {

RegisterServer::RegisterServer(ServerLink& server_link) : server_link(server_link) {

}

RegisterServer::~RegisterServer() {
	server_link.RemoveRequestClient(this);
}

void RegisterServer::RequestList(tool::REQUEST_LIST& request_list) {
	request_list.push_back(proto::PRegisterServer::URI);
}

void RegisterServer::OnRequest(pack::Request& request) {
	proto::RRegisterServer packet;
	pack::Request out_request(server_link.GetSocket()->GetOutBuffer());

	packet.is_success = true;
	packet.ip = 0;
	packet.port = 9999;
	packet.server_id = 1;

	out_request.Pack(&packet);	
	server_link.GetSocket()->Send("", 0);
}

}
